import { request } from "@/utils";

export const getChannelApi = () => {
  return request({
    url: "/channels",
    method: "GET",
  });
};

export const createArticleApi = (data) => {
  return request({
    url: "/mp/articles?draft=false",
    method: "POST",
    data,
  });
};
//获取文章列表
export const getArticleListApi = (params) => {
  return request({
    url: "/mp/articles",
    method: "GET",
    params,
  });
};

//删除id
export const delArticleApi = (id) => {
  return request({
    url: `/mp/articles/${id}`,
    method: "DELETE",
  });
};

// 文章详情
export const getArticleByIdApi = (id) => {
    return request({
      url: `/mp/articles/${id}`,
      method: "GET",
    });
  };
  
// 发布文章
  export const updateArticleApi = (data) => {
    return request({
      url: `/mp/articles/${data.id}?draft=false`,
      method: "PUT",
      data,
    });
  };